I have doors filter in string format which I need to apply on specific doors module, I get to know that I can use eval_ so I used that code and it was working properly in one of my doors instance but the same code failing when running other doors instance.
Below are the details of the code and doors version when that same code is failing.
Doors Version : 9.6.1.10
DXL Code
bool setFilter (Module m, string filtStr) {
string code = "Module m = addr_ " ((addr_ m) int) "\ncurrent=m\nFilter f = " filtStr"\n; set f"
noError(); eval_ code;
return (null lastError)
}
noError()
string strOK = "((attribute \"Last Modified On\" >= \"9/10/2018\") && ( attribute \"ObjType\" == \"Reqt\" ))"
print strOK "\n"
print setFilter (current Module, strOK )
print "\n Error Details If any found : " lastError
DXL Output
((attribute "Last Modified On" >= "9/10/2018") && ( attribute "ObjType" == "Reqt"))
Can you let me know what could be issue here ? Is this right api to apply filter or any other better api ?
AKVD_Hardik_Shah - Thu Sep 27 03:33:36 EDT 2018 |
Re: Error in execution of doors filter using eval_ The problem is the DXL code, that you generate. As you you you are getting the output of all print statements... You need to read the 64 bit migration guide for the eval_ ... You have to use the Addr64 type instead of the old ((addr_ m) int) trick. If you need more info, I can find the forum post for you. Regards, Mathias |
Re: Error in execution of doors filter using eval_ Mathias Mamsch - Thu Sep 27 10:53:34 EDT 2018 The problem is the DXL code, that you generate. As you you you are getting the output of all print statements... You need to read the 64 bit migration guide for the eval_ ... You have to use the Addr64 type instead of the old ((addr_ m) int) trick. If you need more info, I can find the forum post for you. Regards, Mathias Ok, as per this article https://www.ibm.com/developerworks/community/forums/html/topic?id=d7274c76-77e4-4932-ab29-829cb132dd4e I found that integer handling inside the DOORS client only handle 32 bit numbers so due that it looks the above DXL code is not wokring.
Let me found out alternate solution but I have other question as below.
I have doors filter in string format which I need to apply on specific doors module, I get to know that I can use eval_ so question Is this right api to use eval_ for applying filter or any other better api ? |
Re: Error in execution of doors filter using eval_ AKVD_Hardik_Shah - Fri Sep 28 01:19:06 EDT 2018 Ok, as per this article https://www.ibm.com/developerworks/community/forums/html/topic?id=d7274c76-77e4-4932-ab29-829cb132dd4e I found that integer handling inside the DOORS client only handle 32 bit numbers so due that it looks the above DXL code is not wokring.
Let me found out alternate solution but I have other question as below.
I have doors filter in string format which I need to apply on specific doors module, I get to know that I can use eval_ so question Is this right api to use eval_ for applying filter or any other better api ? Well there is two drawbacks to the eval_ approach as far as I can see it: - When I remember right, there is no way to check if the filter string is semantically correct (valid syntax, but invalid content) before you set it. If an attribute is missing there will be a popup box which you cannot suppress. - Well - although there is no security in DOORS Classic anyway - performing an eval_ on some untrusted filter string (stored in some module, or something) is a potential security risk. A malicious eval_ string could perform all kinds of actions on the system.
So the alternate way would be to make a small parser that will parse the filter string and build up the filter, thereby checking for the existence of attributes, etc. I am sure somebody has already done this, and if you are lucky somebody might share the code with you. There are already example out in the public domain as far as I remember.
Regards, Mathias |
Re: Error in execution of doors filter using eval_ Thank you for giving clarity on this. |